<!--
 * @Author: tanlijun 2060803224@qq.com
 * @Date: 2022-11-16 21:07:25
 * @LastEditors: tanlijun 2060803224@qq.com
 * @LastEditTime: 2022-11-16 21:31:39
 * @FilePath: \js基础\js基础第三天\作业\练习题7.html
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>


  <script>
    // 计算[2, 6, 18, 15, 40] 中能被3整除的偶数的个数
    // 1.数值初始化
    let arr = [2, 6, 18, 15, 40]
    let j = 0
    // 2.通过for循环 if判断
    for (let i = 0; i <= arr.length; i++) {
      if (arr[i] % 3 == 0 && arr[i] % 2 == 0) {
        j = j + 1
      }
    }
    alert(`${j}`)
  </script>
</body>

</html>